# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Compute.V1.Model.PerInstanceConfig do
  @moduledoc """


  ## Attributes

  *   `fingerprint` (*type:* `String.t`, *default:* `nil`) - Fingerprint of this per-instance config. This field can be used in optimistic locking. It is ignored when inserting a per-instance config. An up-to-date fingerprint must be provided in order to update an existing per-instance configuration or the field needs to be unset.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of a per-instance configuration and its corresponding instance. Serves as a merge key during UpdatePerInstanceConfigs operations, that is, if a per-instance configuration with the same name exists then it will be updated, otherwise a new one will be created for the VM instance with the same name. An attempt to create a per-instance configuration for a VM instance that either doesn't exist or is not part of the group will result in an error.
  *   `preservedState` (*type:* `GoogleApi.Compute.V1.Model.PreservedState.t`, *default:* `nil`) - The intended preserved state for the given instance. Does not contain preserved state generated from a stateful policy.
  *   `status` (*type:* `String.t`, *default:* `nil`) - The status of applying this per-instance configuration on the corresponding managed instance.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :fingerprint => String.t() | nil,
          :name => String.t() | nil,
          :preservedState => GoogleApi.Compute.V1.Model.PreservedState.t() | nil,
          :status => String.t() | nil
        }

  field(:fingerprint)
  field(:name)
  field(:preservedState, as: GoogleApi.Compute.V1.Model.PreservedState)
  field(:status)
end

defimpl Poison.Decoder, for: GoogleApi.Compute.V1.Model.PerInstanceConfig do
  def decode(value, options) do
    GoogleApi.Compute.V1.Model.PerInstanceConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Compute.V1.Model.PerInstanceConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
